<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>我发起的的不合格处置</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/layui.css"  media="all">
	<link rel="stylesheet" href="${pageContext.request.contextPath }/assets/css/toastr.min.css"  media="all">
</head>
<body>
<div class="demoTable" style="padding:10px 0 0 15px">
    <div class="layui-inline">
       	<input class="layui-input" id="keyword" placeholder="请输入处置单号"/>
    </div>
    <button class="layui-btn layui-btn-blue" style="margin: 0 0 0 10px" data-type="reload"><i class="layui-icon layui-icon-search">  搜索</i></button>
</div>
<h2 style="text-align: center;color:#666">处置单</h2>
<table class="layui-hide" id="disposeRejects" lay-filter=disposeRejects></table>
<h2 style="text-align: center;color:#666" id="detailsTitle" class="layui-hide">处置单详情</h2>
<table class="layui-hide" id="disposeRejectsDetails" lay-filter=disposeRejectsDetails></table>
<script type="text/html" id="barDemoDetails">
	<a class="layui-btn layui-btn-xs" lay-event="checkDetails">检测结果</a>
</script>
<script src="${pageContext.request.contextPath }/assets/layui.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/assets/layui.all.js"></script>
<script src="${pageContext.request.contextPath }/assets/js/jquery.min.js" charset="utf-8"></script>
<script src="${pageContext.request.contextPath }/assets/js/toastr.min.js" charset="utf-8"></script>
<script type="text/javascript">
function date2String(timestamp){
	var d = new Date(timestamp);
	var date = (d.getFullYear()) + "-" + 
       (d.getMonth() + 1<10?"0"+(d.getMonth() + 1):d.getMonth() + 1) + "-" +
       (d.getDate()<10?"0"+d.getDate():d.getDate()) + " " + 
       (d.getHours()<10?"0"+d.getHours():d.getHours()) + ":" + 
       (d.getMinutes()<10?"0"+d.getMinutes():d.getMinutes()) + ":" + 
       (d.getSeconds()<10?"0"+d.getSeconds():d.getSeconds());
       
       return date;
}
layui.use(['table','layer','upload','form'], function(){
	var table = layui.table;
	var layer = layui.layer,
    form = layui.form;
	var $ = layui.jquery, active = {
			reload:function () {
				var keyword = $("#keyword").val();
				table.reload('contenttable',{
					method:'get',
					where:{keyword:keyword}
					,page: {
						curr: 1 //重新从第 1 页开始
					}
				});
			}
		}
	$('.layui-btn').on('click', function(){
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });
	table.render({
	    elem: '#disposeRejects'
	    ,url:'${pageContext.request.contextPath }/disposeRejectsApproval/selectMyApprovelList.do'
	    ,title: '不合格处置列表'
	    ,id :'contenttable'
	    ,limits:[10,20,30]
	    ,cols: [[
	      {field:'', title:'序号', sort: true, type:'numbers', width: 60}
	      ,{field:'dNumber', title:'处置单号'}
	      ,{field:'dWay', title:'处置结果'}
	      ,{field:'dDisponer', title:'处置人'}
	      ,{field:'dDisposeDate', title:'处置日期',templet :function (row){
        		return date2String(row.dDisposeDate.time);
    		}   
	      }
	      ,{field:'dApproverStatus', title:'审批状态',templet :function (row){
	    	  	if(row.dApproverStatus == 0){
	    	  		return "已驳回";
	    	  	}else if(row.dApproverStatus == 4){
	    	  		return "已同意";
	    	  	}else{
	    	  		return "审批中";
	    	  	}
    		}   
	      }
	    ]]
	    ,page: true
	});
	//监听行单击事件(子表)
	 table.on('row(disposeRejects)', function(obj){
		$("#detailsTitle").removeClass("layui-hide");
		var dId = obj.data.dId;
	  	table.render({
		    elem: '#disposeRejectsDetails'
		    ,url:'${pageContext.request.contextPath }/disposeRejects/selectDisposeRejectsDetailsListBydId.do'
		    ,where:{dId: dId}
		    ,title: '不合格处置详情表'
		    ,limits:[10,20,30]
		    ,cols: [[
		    	{field:'', title:'序号', sort: true, type:'numbers', width: 60}
		    	,{field:'ddNumber', title:'质检单号' }
			     ,{field:'ddName', title:'名称'}
			     ,{field:'remark01', title:'条码'}
			     ,{field:'insDate', title:'报检日期',templet :function (row){
		        		return date2String(row.insDate);
		    		}   
			     }
			     ,{field:'testDate', title:'检验日期',templet :function (row){
		        		return date2String(row.testDate);
		    		} 
			     }
			     ,{field:'badNum', title:'数量'}
			     ,{field:'remark02', title:'工位来源'}
			     ,{fixed: 'right', title:'操作', toolbar: '#barDemoDetails'}
		    ]]
		    ,page: true
		});
	});
	//监听行工具事件（子表）
	table.on('tool(disposeRejectsDetails)', function(obj){
		var data = obj.data;
		if(obj.event === 'checkDetails'){
		    var tStation = data.remark02;
		    var tNumber = data.ddNumber;
		    if(tStation=="检漏工位"){
				layer.open({
				        type: 1 					//Page层类型
				        ,area: ['95%', '600px']   //宽  高
				        ,title: '检测结果'
				        ,shade: 0.6 				//遮罩透明度
				        ,maxmin: true			    //允许全屏最小化
				        ,anim: 1 					//0-6的动画形式，-1不开启
				        /* ,content: $("#lookupTable2") */
				        ,content: '<table class="layui-hide" id="evResult" lay-filter="evResult"></table>'
				        ,success:function(){
				            layui.use(['table'], function(){
				                var table = layui.table;
				                table.render({
				                    elem: '#evResult'
				                    ,url:'${pageContext.request.contextPath }/disposeRejects/selectLeakHuntingListByNumber.do?ptNumber='+tNumber
				                    ,title: '质检列表'
				                    ,limits:[10,20,30]
				                    ,cols: [[
				                        {field:'number', title:'质检单号'}
				                        ,{field:'lhCode', title:'条码'}
				                        ,{field:'facilityNumber', title:'设备编码'}
				                        ,{field:'bDlNumBig', title:'B面堵漏个数大'}
				                        ,{field:'bDlNumSmall', title:'B面堵漏个数小'}
				                        ,{field:'aDlNumBig', title:'A面堵漏个数大'}
				                        ,{field:'aDlNumSmall', title:'A面堵漏个数小'}
				                        ,{field:'aCount', title:'A面总数'}
				                        ,{field:'bCount', title:'B面总数'}
				                        ,{field:'isNormal', title:'检漏是否正常'}
				                        ,{field:'dmbj', title:'端面补胶'}
				                        ,{field:'describe', title:'非正常问题描述'}
				                        ,{field:'lhResult', title:'检测结果'}
				                        ,{field:'testPerson', title:'检测人'}
				                        ,{field:'testTime', title:'检测时间'}
				                    ]]
				                    ,page: true
				                });
				            });
				        }
					})
			}
			else if(tStation=="组件评价工位"){
				layer.open({
				        type: 1 					//Page层类型
				        ,area: ['95%', '600px']   //宽  高
				        ,title: '检测结果'
				        ,shade: 0.6 				//遮罩透明度
				        ,maxmin: true			    //允许全屏最小化
				        ,anim: 1 					//0-6的动画形式，-1不开启
				        /* ,content: $("#lookupTable2") */
				        ,content: '<table class="layui-hide" id="evResult" lay-filter="evResult"></table>'
				        ,success:function(){
				            layui.use(['table'], function(){
				                var table = layui.table;
				                table.render({
				                    elem: '#evResult'
				                    ,url:'${pageContext.request.contextPath }/disposeRejects/selectEvaluateListByNumber.do?ptNumber='+tNumber
				                    ,title: '质检列表'
				                    ,limits:[10,20,30]
				                    ,cols: [[
				                        {field:'', title:'序号', sort: true, type:'numbers', width: 60}
				                        ,{field:'number', title:'质检单号'}
				                        ,{field:'evCode', title:'条码'}
				                        ,{field:'facilityNumber', title:'设备编码'}
				                        ,{field:'yxsw', title:'运行水温'}
				                        ,{field:'jsyl', title:'进水压力'}
				                        ,{field:'csyl', title:'产水压力'}
				                        ,{field:'nsyl', title:'浓水压力'}
				                        ,{field:'cstl', title:'产水通量'}
				                        ,{field:'nstl', title:'浓水通量'}
				                        ,{field:'yxTime', title:'运行时间'}
				                        ,{field:'evResult', title:'检测结果'}
				                        ,{field:'testPerson', title:'检测人'}
				                        ,{field:'testTime', title:'检测时间'}
				                    ]]
				                    ,page: true
				                });
				            });
				        }
					})
			}else if(tStation=="气密性检测工位"){
				layer.open({
				        type: 1 					//Page层类型
				        ,area: ['95%', '600px']   //宽  高
				        ,title: '检测结果'
				        ,shade: 0.6 				//遮罩透明度
				        ,maxmin: true			    //允许全屏最小化
				        ,anim: 1 					//0-6的动画形式，-1不开启
				        /* ,content: $("#lookupTable2") */
				        ,content: '<table class="layui-hide" id="gResult" lay-filter="gResult"></table>'
				        ,success:function(){
				            layui.use(['table'], function(){
				                var table = layui.table;
				                table.render({
				                    elem: '#gResult'
				                    ,url:'${pageContext.request.contextPath }/disposeRejects/selectGasListByNumber.do?ptNumber='+tNumber
				                    ,title: '质检列表'
				                    ,limits:[10,20,30]
				                    ,cols: [[
				                        {field:'', title:'序号', sort: true, type:'numbers', width: 60}
				                        ,{field:'number', title:'质检单号'}
				                        ,{field:'gCode', title:'条码'}
				                        ,{field:'facilityNumber', title:'设备编码'}
				                        ,{field:'gIntervalTime', title:'出泡间隔时间',templet:function(row){
				                        	if(row.gIntervalTime==0){
				                        		return "其他";
				                        	}else {
				                        		return row.gIntervalTime;
				                        	}
				                        }}
				                        ,{field:'gResult', title:'检测结果'}
				                        ,{field:'testPerson', title:'检测人'}
				                        ,{field:'testTime', title:'检测时间'}
				                    ]]
				                    ,page: true
				                });
				            });
				        }
					})
			}else{
				layer.open({
				        type: 1 					//Page层类型
				        ,area: ['95%', '600px']   //宽  高
				        ,title: '检测结果'
				        ,shade: 0.6 				//遮罩透明度
				        ,maxmin: true			    //允许全屏最小化
				        ,anim: 1 					//0-6的动画形式，-1不开启
				        /* ,content: $("#lookupTable2") */
				        ,content: '<table class="layui-hide" id="testResult" lay-filter="testResult"></table>'
				        ,success:function(){
				            layui.use(['table'], function(){
				                var table = layui.table;
				                table.render({
				                    elem: '#testResult'
				                    ,url:'${pageContext.request.contextPath }/disposeRejects/selectTestListByNumber.do?ptNumber='+tNumber
				                    ,title: '质检列表'
				                    ,limits:[10,20,30]
				                    ,cols: [[
				                        {field:'', title:'序号', sort: true, type:'numbers', width: 60}
				                        ,{field:'tNumber', title:'质检单号'}
				                        ,{field:'tIndex', title:'检测项'}
				                        ,{field:'tStandard', title:'规格'}
				                        ,{field:'upper', title:'上限值'}
				                        ,{field:'lower', title:'下限值'}
				                        ,{field:'tValue', title:'检测值'}
				                        ,{field:'tIndexValue', title:'检测数量'}
				                        ,{field:'tFineValue', title:'检测合格数量'}
				                        ,{field:'tBadValue', title:'检测不合格数量'}
				                        ,{field:'tResult', title:'检测结果'}
				                    ]]
				                    ,page: true
				                });
				            });
				        }
					})
			}
		}
	})
})
toastr.options.positionClass = 'toast-top-center'; //提示框的位置设置为中上
</script>
</body>
</html>